Repository navigation
feat(install): add DeepSeek Harness (dsh) platform support - #5443
Draft
estebanmunchjones2019 wants to merge 6 commits into
Draft
estebanmunchjones2019 wants to merge 6 commits into
estebanmunchjones2019 wants to merge 6 commits into
Conversation
A dsh user got no skill and no way to make the harness consult a built graph; the only route was text in AGENTS.md, which the model is free to ignore. DSH ships @deepseek-ai/dsh-hooks-claude-code, a bridge that replays a Claude-Code hooks.json onto its own pre-tool seams, so the gap was install wiring and tool-name vocabulary, not a second guard. - guard: a per-host tool-name vocabulary (read/grep/glob/bash beside the Claude-cased names) takes the same policy branches, so one module serves both dialects. - guard: opt-in `until-query` deny mode with its own cap. `once` remains the mode every install records by default, so no host is installed stricter than another. - guard: new host-neutral `session` kind that states the graph on any start source and resets the nudge/deny budget after a compaction. - installer: `graphify dsh install|uninstall` writes the skill, a Claude-shaped .dsh/hooks.json and a cordis overlay that mounts the bridge. Advisory by default; `--strict` opts into the one-shot deny at either scope, matching `graphify claude install --strict`. Lowercase matchers and a seconds-based timeout match DSH's parser. - detect: the two dsh files graphify writes whole are recognised so they never become graph nodes. - skillgen: rendered dsh skill bundle and references; README platform table and always-on paragraph. - tests: DSH payload shapes, both deny modes and caps, the three-artifact install, merge/uninstall safety, and advisory-vs-strict hook flags. Co-Authored-By: DeepSeek <noreply@deepseek.com>
`dsh plugin add` refuses a bridge older than the running runtime, so the 0.2.2-rc.5 pin fails on a current dsh (0.2.3-alpha.2): the command the install prints is rejected before anything mounts. Track the current line, and say in the rendered reference that a user on a different line installs the bridge version matching their runtime. Also correct that reference's hook-policy sentence, which still claimed the install carries `--strict --deny-mode until-query`; a plain install is advisory and `--strict` opts into the one-shot deny. Co-Authored-By: DeepSeek <noreply@deepseek.com>
DeepSeek Harness's Claude-Code bridge passes `tool_input` as the JSON text the model emitted rather than a parsed object, so the guard returned at its `isinstance(t, dict)` check: every DSH hook fired and did nothing - no nudge, no deny, even on a strict install. Caught by a live session; the dict-shaped fixtures could not see it. Parse the string form, keep failing open on anything unparseable, and pin both with DSH payload tests. Co-Authored-By: DeepSeek <noreply@deepseek.com>
|
Thanks for the pull request, @estebanmunchjones2019. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic. |
…payload The live payload from dsh 0.2.3-alpha.2 + bridge 0.2.3-alpha.2 carries a parsed `tool_input` holding a workspace-relative path, not the absolute one every read fixture used. Add that shape, plus the gaps the review found: - install with $DSH_HOME unset (the default path, never exercised); - install -> uninstall -> install restores exactly one fence and two groups; - uninstall on a never-installed machine writes nothing; - a hooks.json whose `hooks` is not an object is refused, not clobbered; - `graphify install --platform dsh --strict` skips the Claude-only note; - a user-scope exe path with a space is quoted in the hook command; - grep of one indexed file denies once and then advises; - GRAPHIFY_HOOK_DENY_CAP=0 means never deny; - the command the installer writes actually produces the deny when executed. Co-Authored-By: DeepSeek <noreply@deepseek.com>
Claude Code has one deny policy and no flag to change it, and the point of this branch is to give DeepSeek Harness that same behaviour. The opt-in `--deny-mode` surface added earlier worked against that: it had no counterpart in the reference host, and a mode recorded without `--strict` was a policy that could never fire. Remove the whole surface - `--deny-mode` (installer and hook dispatch), `GRAPHIFY_HOOK_DENY_MODE`, `GRAPHIFY_HOOK_DENY_CAP`, the `<sid>.denials` counter and `_claim_denial` - and restore the `_READ_DENY` / `_SEARCH_DENY` payloads verbatim, so `_run_hook_guard(kind, strict)` emits exactly what Claude Code installs emit. Tests: the deny-mode cases become one-shot contract cases (one block, then advice; a query releases the next read; a compaction restores the block), and the installer tests drop the flag cases. README, the dsh hooks fragment and its rendered artifacts follow. Co-Authored-By: DeepSeek <noreply@deepseek.com>
The fragment was edited but the rendered reference was left out of the previous commit, so the shipped skill still described a flag the guard no longer has. Co-Authored-By: DeepSeek <noreply@deepseek.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
graphify dsh install(orgraphify install --platform dsh) sets graphify up for DeepSeek Harness.DeepSeek Harness does not read a hooks file by itself — it only runs hooks when a small adapter package is mounted. So one install writes three things:
~/.dsh/skills/graphify/(or./.dsh/skills/graphify/with--project).~/.dsh/hooks.json(or./.dsh/hooks.json): the "before a tool runs" hooks, in the same format Claude Code uses.~/.dsh/cordis.patch.yml, the layer every profile applies, or a small./.dsh/graphify.cordis.ymlfile for a project install.Restart DeepSeek Harness afterwards. A project install is started with
dsh --patch .dsh/graphify.cordis.yml; a user install needs no extra flags.What the agent sees
graphify query. The session also opens with that line, so the agent knows about the graph before its first tool call.--strict— one refusal. Exactly what Claude Code's strict mode does: the first raw file read or code search is declined with a message telling the agent to query the graph first and retry, and the retry is allowed. One refusal per session, never more, so a task cannot get stuck. It works at either scope.There is no third setting and no repeat-deny mode. Claude Code has one deny policy, and DeepSeek Harness gets that same policy through the same code — nothing stronger, nothing configurable.
Files the graph does not index, files outside the project, and graphify's own output directory are never refused.
Other changes
Read/read,Grep/grep,Bash/bash) and both argument shapes (an object or a JSON string), so one policy serves both hosts instead of a second copy.hook-guard sessionevent for hosts whose session start also fires on startup/resume/clear, not only on compaction. Claude Code keeps its compact-only hook, so its behaviour is unchanged.0.2.3-alpha.2. The publishedlatesttag is much older and does not send the events these hooks need, and a newer DeepSeek Harness refuses to load it.graphify detectskips.dsh/hooks.jsonand.dsh/graphify.cordis.yml— files the installer writes, not source to describe.Testing
Started from a clean machine: graphify was removed from DeepSeek Harness first (
graphify dsh uninstall, leftover files deleted), then installed again from scratch. The fresh install recreated the skill,hooks.jsonand the patch fence, anddsh --dump-configshowed thegraphify-hooksrow mounted.Live sessions, all on the
headlessprofile with dsh 0.2.3-alpha.2 and adapter 0.2.3-alpha.2, run in a copy of this repository (25,230 graph nodes, 1,276 indexed files):source.kind: "hooks-claude-code"— the injection lands before the first tool call.graphify query/graphify explaincalls and answered from graph nodes (_dsh_wiringat L2434,_dsh_installat L2450, and so on) without opening a single source file.graphify/install.pybefore any query, the call was refused with the redirect:hook/invokedfollowed byhook/result: denyin the session log, the marker written undergraphify-out/cache/hook_sessions/, then the retry allowed. The same sequence reproduced in a small scratch project.graphify queryitself, later reads passed — that is the design: the guard says nothing while a recent query is on record.Unit tests: 42 in
tests/test_hook_dsh.pyandtests/test_install_dsh.py— the payload shape the adapter really sends (parsed arguments, workspace-relative path), the one-refusal-then-advice contract, a query releasing the next read, a compaction restoring the block, installing where$DSH_HOMEis unset, install → uninstall → install, uninstall on a machine that never installed, refusing ahooks.jsonthat cannot be merged,graphify install --platform dsh --strict, an executable path containing a space, a single-file grep refusal, and the installer's own command executed end to end.test_detect,test_skillgenandtest_hook_nudge_wordingpass alongside them,uv run python -m tools.skillgen --checkpasses, and the full suite is 11,690 passed, 167 skipped, 1 xfailed. Its one red test,test_graph_context_cache_reload.py::test_concurrent_first_load_of_new_path_builds_once, is timing-dependent and fails on the untouched base too (5 runs on each: base 2 pass / 3 fail, branch 3 pass / 2 fail).One correction to how this branch described its last commit: a fresh capture shows the adapter hands the hook the tool arguments as an object, not as the model's raw JSON text. The string form is accepted as extra tolerance and covered by a test, but it was not what made the live session work — a run with that parsing removed still refuses correctly.
Companion edit
The published docs site (docs.graphify.com) is not in this repo and needs its own paragraph for the dsh platform.